'use strict';

const fs = require('fs');
const base = require('./baseFields');

let env = process.env.RUNTIME_ENV || 'development';
let envPath = `./${env}.js`;

try {
  fs.accessSync(envPath);
} catch (e) {
  // quite fail
  env = null;
}

// set default value as {}
const upperConfig = env ? require(`./${env}`) : {};

const config = Object.assign(base, upperConfig);

module.exports = config;
